package com.sesame.consumerdemo.web;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.sesame.consumerdemo.service.UserFeiginService;
import com.sesame.consumerdemo.vo.UserVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.catalina.User;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@RestController
@RequestMapping(value = "/consumer")
@Slf4j
public class ConsumeController {

    @Autowired
    private UserFeiginService userFeiginService;

    @GetMapping(value = "/getAllUser")
    public String getUsers(){

        log.info("get a request from client ...");

        Object result = userFeiginService.getAllUser();

        return JSON.toJSONString(result);
    }


}
